<?php
namespace RMD\AccountBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

use RMD\AccountBundle\Entity\Condition;
use RMD\AccountBundle\Form\DataTransformer\TestTransformer;

class SegmentType extends AbstractType
{
	public function buildForm(FormBuilderInterface $builder, array $options) {
		$segmentOptions = $options['segmentOptions'];
		$choices = array();
		foreach ($segmentOptions as $field => $segment) {
			$choices[$field] = $segment['Title'];
		}
		$builder->add('field', 'choice', array(
			'choices'   => $choices,
			'required'  => true,
		));
	}

    public function getName() {
        return 'segment';
    }
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => null,//'RMD\AccountBundle\Entity\Condition',
            'intention'       => 'segment_item'
        ));
		$resolver->setRequired(array('segmentOptions'));
    }
}
?>
